﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;

namespace Csharp {
    public class EventConsumerWrong {
        private Timer _timer;


        public EventConsumerWrong(Timer timer) {
            _timer = timer;

            _timer.Elapsed += (sender, e) => Console.WriteLine("Tick!");
        }

        public static void Run() {
            Timer timer = new Timer(100);
            EventConsumerWrong ecw = new EventConsumerWrong(timer);
            timer.Start();

            ecw = null;
            System.Threading.Thread.Sleep(1000);
        }
    }
}
